package com.hu.zhcc.shiro.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hu.zhcc.shiro.dao.EmpDAO;
import com.hu.zhcc.shiro.entity.bo.Emp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service("empService")
public class EmpServiceImpl implements EmpService{
    @Autowired
    EmpDAO empDAO;
    @Override
    public PageInfo<Emp> listAllEmp(Integer offset, Integer limit) {
        PageHelper.startPage(offset,limit);
        List<Emp> emps = empDAO.ListAllEmp();

        PageInfo<Emp> pageInfo = new PageInfo<>(emps);

        return pageInfo;
    }

    @Override
    public Emp getEmp(Integer id) {
        Emp emp = empDAO.getEmp(id);
        return emp;
    }

    @Override
    public String updateEmp(Integer id, Emp emp) {
        int i = empDAO.updateEmp(emp);
        return "wll";
    }
}
